FROM golang:1.21-alpine AS builder
WORKDIR /build
COPY . .
RUN go env -w GO111MODULE=on \
    && go env -w GOPROXY=https://goproxy.cn,direct \
    && go env -w CGO_ENABLED=0 \
    && go env \
    && go mod tidy \
    && go build -o server

FROM alpine
LABEL MAINTAINER="Poifa@1749094641@qq.com"
COPY --from=builder /usr/local/go/lib/time/zoneinfo.zip /opt/zoneinfo.zip
COPY --from=builder /build/server /

ENV ZONEINFO /opt/zoneinfo.zip

EXPOSE 8080
ENTRYPOINT ["/server"]